/*
Define 
class Base {
 public:
        virtual void iam() {  cout << Base\n"; }
};

Derive two classes from Base, and for each define iam() to write out the name of the class. Create objects of these classes and call iam() for them. Assign pointers to objects of the derived classes to  Base*  pointers and call iam() through those pointers.*/


#include <iostream>
using namespace std;

class Base
{
public:
    virtual void iam(){cout<<"Base!"<<endl;}
};

class Derived_1:public Base{
public:
    virtual void iam(){ cout<<"Derived_1!"<<endl;}
};

class Derived_2:public Base{
public:
    virtual void iam(){ cout<<"Derived_2!"<<endl;}
};

int main(int argc, char const *argv[])
{
    Base* myBase = new Base();
    Derived_1* myDeri_1 = new Derived_1();
    Derived_2* myDeri_2 = new Derived_2();

    myBase->iam();
    myDeri_1->iam();
    myDeri_2->iam();

    cout<<"-----------"<<endl;
    Base* Base_1 = new Derived_1();
    Base* Base_2 = new Derived_2();

    Base_1->iam();
    Base_2->iam();
    return 0;
}
